<?php

declare(strict_types=1);

namespace app\common\model;

class Activity extends Base
{

    protected $name = 'activity';
    public function getStatusTextAttr($value, $data)
    {
        $time = time();
        if ($time < $data['bm_s_time']) {
            $value = '报名未开始';
        } else if ($time > $data['bm_s_time'] && $time < $data['bm_e_time']) {
            $value = '报名中';
        } else if ($time > $data['bm_e_time'] && $time < $data['hd_s_time']) {
            $value = '报名已结束';
        } else if ($time > $data['hd_s_time'] && $time < $data['hd_e_time']) {
            $value = '活动进行中';
        } else {
            $value = '活动已结束';
        }
        return $value;
    }
    /**
     * 获取活动报名情况
     */
    public function getSignTextAttr($value, $data)
    {
        $time = time();
        if ($time > $data['bm_s_time'] && $time < $data['bm_e_time']) {
            $value = '报名中';
        } else if ($time > $data['bm_e_time']) {
            $value = '已结束';
        }
        return $value;
    }
}
